﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Abs.App.Admin
{
    public partial class Appointment_Details : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //Kicks the non admin accounts out
            if (Session["Role"] == null)
                Response.Redirect("~/User/Unauthorized_Access.aspx");
            if ((int)Session["Role"] == (int)Abs.Core.Models.User.RoleEnum.User)
                Response.Redirect("~/User/Unauthorized_Access.aspx");
            
            var appManager = Abs.Core.Management.Manage.Appointment;
            var appointment = appManager.SelectAppointment(int.Parse(Request.QueryString["Id"]));
            if (appointment == null)
            {
                Response.Redirect("~/Default.aspx");
            }

            Label_Room.Text = appointment.Room.Name;
            Label_User.Text = appointment.User.Name;
            Label_Date.Text = appointment.StartTime.ToShortDateString();
            Label_STime.Text = appointment.StartTime.ToShortTimeString();
            Label_ETime.Text = appointment.EndTime.ToShortTimeString();
            Text_Comments.Text = appointment.Comment;
        }
    }
}